﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;

namespace UnitLibrary.GameObjects.Physics
{
    public class PhyGen
    {
        public string PhyGenName = string.Empty;
        public string PhyBodyName = string.Empty;
        public string PhyGeomName = string.Empty;
        public ObjectShape Object_Shape = ObjectShape.Circle;
        public string TextureName = "default";
        public Color IColor = Color.Black;
        public Color BorderColor = Color.White;
        public Color SensorColor = Color.HotPink;
        public Color SensorBorderColor = Color.Black;
        public int Radius = 10;
        public int SensorRadius = 20;
        public int Width = 10;
        public int Height = 10;
        public double MovementUpdateDelay = 40;
        protected double MovementUpdateDelayTimer = 0;

        /// <summary>
        /// Do a clone of values loaded from the content pipeline into this object
        /// </summary>
        /// <param name="genericUnit"></param>
        public void DeepCopy(object objPhyGen)
        {
            PhyGen phyGen = (PhyGen)objPhyGen;
            this.PhyGenName = phyGen.PhyGenName;
            this.PhyBodyName = phyGen.PhyBodyName;
            this.PhyGeomName = phyGen.PhyGeomName;
            this.Object_Shape = phyGen.Object_Shape;
            this.TextureName = phyGen.TextureName;
            this.IColor = phyGen.IColor;
            this.BorderColor = phyGen.BorderColor;
            this.SensorColor = phyGen.SensorColor;
            this.SensorBorderColor = phyGen.SensorBorderColor;
            this.Radius = phyGen.Radius;
            this.SensorRadius = phyGen.SensorRadius;
            this.Width = phyGen.Width;
            this.Height = phyGen.Height;
            this.MovementUpdateDelay = phyGen.MovementUpdateDelay;
        }

        public virtual void ReadContent(ContentReader input)
        {
            this.PhyGenName = input.ReadString();
            this.PhyBodyName = input.ReadString();
            this.PhyGeomName = input.ReadString();
            this.Object_Shape = input.ReadObject<ObjectShape>();
            this.TextureName = input.ReadString();
            this.IColor = input.ReadColor();
            this.BorderColor = input.ReadColor();
            this.SensorColor = input.ReadColor();
            this.SensorBorderColor = input.ReadColor();
            this.Radius = input.ReadInt32();
            this.SensorRadius = input.ReadInt32();
            this.Width = input.ReadInt32();
            this.Height = input.ReadInt32();
            this.MovementUpdateDelay = input.ReadDouble();
        }
    }
}
